package net.jxiny.oschina.tweet.Adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;


import net.jxiny.oschina.R;
import net.jxiny.oschina.tweet.enyity.Topic;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class TopicAdapter extends BaseQuickAdapter<Topic, BaseViewHolder>{
    public TopicAdapter(int layoutResId, @Nullable List<Topic> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Topic item) {
        helper.setText(R.id.topic_body,item.getBody());
        helper.setText(R.id.topic_time,item.getPubDate());
        helper.setText(R.id.topic_author,item.getAuthor());
        helper.setText(R.id.commentCount,item.getCommentCount());
        ImageView imageView = helper.getView(R.id.topic_profile);
        Glide.with(mContext).load(item.getPortrait()).into(imageView);
    }
}
